SQLAlchemy — это штука, которая сильно упрощает работу с базами данных в Python. Она позволяет писать код так, будто ты работаешь с обычными объектами, а не с таблицами. Но если нужно, всегда можно написать чистый SQL-запрос.
Например, вот как легко создать таблицу пользователей и добавить туда запись:
from sqlalchemy import create_engine, Column, Integer, String from sqlalchemy.orm import declarative_base, sessionmaker
Base = declarative_base()
class User(Base): tablename = 'users' id = Column(Integer, primary_key=True) name = Column(String)
SQLAlchemy — это штука, которая сильно упрощает работу с базами данных в Python. Она позволяет писать код так, будто ты работаешь с обычными объектами, а не с таблицами. Но если нужно, всегда можно написать чистый SQL-запрос.
Например, вот как легко создать таблицу пользователей и добавить туда запись:
from sqlalchemy import create_engine, Column, Integer, String from sqlalchemy.orm import declarative_base, sessionmaker
Base = declarative_base()
class User(Base): tablename = 'users' id = Column(Integer, primary_key=True) name = Column(String)
Mr. Durov launched Telegram in late 2013 with his brother, Nikolai, just months before he was pushed out of VK, the Russian social-media platform he founded. Mr. Durov pitched his new app—funded with the proceeds from the VK sale—less as a business than as a way for people to send messages while avoiding government surveillance and censorship.
China’s stock markets are some of the largest in the world, with total market capitalization reaching RMB 79 trillion (US$12.2 trillion) in 2020. China’s stock markets are seen as a crucial tool for driving economic growth, in particular for financing the country’s rapidly growing high-tech sectors.Although traditionally closed off to overseas investors, China’s financial markets have gradually been loosening restrictions over the past couple of decades. At the same time, reforms have sought to make it easier for Chinese companies to list on onshore stock exchanges, and new programs have been launched in attempts to lure some of China’s most coveted overseas-listed companies back to the country.
Python Turbo Уютное сообщество Python разработчиков from nl